<template>
    <h1>{{ "grandson" }}</h1>
    <p>Count: {{ props.num }}</p>
    <button @click="handleClick">+1</button>
</template>

<script setup lang="ts">
import { useAttrs, defineProps, defineEmits } from "vue";
const props = defineProps(["num"]);
const emit = defineEmits(["changeCount"]);
const attrs = useAttrs(); // 获取 $attrs

console.log(attrs);
console.log(props.num); // 访问 num 属性的值

const handleClick = () => {
    // 或者直接使用 emit
    emit("changeCount");
};
</script>

<style scoped></style>
